<%#
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
<%_
const i18nToLoad = [entityInstance];
for (const idx in fields) {
    if (fields[idx].fieldIsEnum === true) {
        i18nToLoad.push(fields[idx].enumInstance);
    }
}
_%>
import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { Link, RouteComponentProps } from 'react-router-dom';
import {
  Button,
  Row,
  Col,
  Label
  <% if (haveFieldWithJavadoc) { %>, UncontrolledTooltip<% } %> } from 'reactstrap';
import { AvFeedback, AvForm, AvGroup, AvInput<% if (fieldsIsReactAvField) { %>, AvField <% } %> } from 'availity-reactstrap-validation';
import {
  <%_ if (fieldsContainBlob) { _%>
  setFileData,
  <% if (fieldsContainBlobOrImage) { %> openFile,<% } %>
  byteSize,
  <%_ } _%>
  Translate,
  translate
} from 'react-jhipster';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { IRootState } from 'app/shared/reducers';

<%_
let hasRelationshipQuery = false;
let otherEntityActions = new Set();
let manyToManyOwners = new Set();
let relFieldNames = new Set();
let uniqueRelationFields = new Set();

Object.keys(differentRelationships).forEach(key => {

  const hasAnyRelationshipQuery = differentRelationships[key].some(rel =>
      (rel.relationshipType === 'one-to-one' && rel.ownerSide === true && rel.otherEntityName !== 'user')
          || rel.relationshipType !== 'one-to-many'
  );
  if (hasAnyRelationshipQuery) {
    hasRelationshipQuery = true;
    differentRelationships[key].forEach(rel => {
      if (rel.relationshipType === 'many-to-many' && rel.ownerSide === true) {
        manyToManyOwners.add(rel);
      } else {
        relFieldNames.add(rel);
      }
    });
  }
  if (differentRelationships[key].some(rel => rel.relationshipType !== 'one-to-many')) {
    const uniqueRel = differentRelationships[key][0];
    uniqueRelationFields.add(uniqueRel.otherEntityNamePlural);
    otherEntityActions.add({
      action: `get${upperFirstCamelCase(uniqueRel.otherEntityNamePlural)}`,
      instance: `${uniqueRel.otherEntityNamePlural}`,
      entity: uniqueRel.otherEntityAngularName,
      reducer: uniqueRel.otherEntityAngularName === 'User' ? 'userManagement' : uniqueRel.otherEntityName
    });
    if (uniqueRel.otherEntityAngularName === 'User') {
_%>
import { I<%= uniqueRel.otherEntityAngularName %> } from 'app/shared/model/user.model';
<%_ if (authenticationType === 'oauth2') { _%>
import { getUsers } from 'app/shared/reducers/user-management';
<%_ } else { _%>
import { getUsers } from 'app/modules/administration/user-management/user-management.reducer';
<%_ } _%>
<%_
  } else {
    if (uniqueRel.otherEntityAngularName !== entityReactName) {
_%>
import { I<%= uniqueRel.otherEntityAngularName %> } from 'app/shared/model/<%= uniqueRel.otherEntityModelName %>.model';
  <%_ } _%>
import { getEntities as get<%= upperFirstCamelCase(uniqueRel.otherEntityNamePlural) %> } from 'app/entities/<%= uniqueRel.otherEntityPath %>/<%= uniqueRel.otherEntityFileName %>.reducer';
<%_ }
  }
}); _%>
import {
  getEntity,
  updateEntity,
  createEntity,
  <%_ if (fieldsContainBlob) { _%>
    setBlob,
  <%_ } _%>
  reset
} from './<%= entityFileName %>.reducer';
import { I<%= entityReactName %> } from 'app/shared/model/<%= entityModelFileName %>.model';
import { convertDateTimeFromServer, convertDateTimeToServer, displayDefaultDateTime } from 'app/shared/util/date-utils';
<%_ if (relationships.filter(e => e.relationshipType === 'many-to-many') !== undefined) { _%>
import { mapIdList } from 'app/shared/util/entity-utils';
<%_ } _%>

export interface I<%= entityReactName %>UpdateProps extends StateProps, DispatchProps, RouteComponentProps<{id: string}>  {}

export const <%= entityReactName %>Update = (props: I<%= entityReactName %>UpdateProps) => {
  <%_ manyToManyOwners.forEach(val => { _%>
  const [ids<%= val.relationshipName %>, setIds<%= val.relationshipName %>] = useState([]);
  <%_ }) _%>
  <%_ relFieldNames.forEach(val => { _%>
  const [<%= val.relationshipFieldName %>Id, set<%= upperFirstCamelCase(val.relationshipFieldName) %>Id] = useState('0');
  <%_ }) _%>
  const [isNew] = useState(!props.match.params || !props.match.params.id);

  const { <%= entityInstance %>Entity,<%
  uniqueRelationFields.forEach(rel => {
  %> <%= rel %>,<% }) %> loading, updating } = props;

  <%_ for (var i = 0; i < blobFields.length; i++) { _%>
  <%_
    const b = blobFields[i];
    if (i === 0) {
  _%>
    const {
    <%_ } _%>
    <%= b.fieldName %>
    <%_ if (b.fieldTypeBlobContent !== 'text') { _%>
    , <%= b.fieldName %>ContentType
    <%_ } _%>
    <%_ if (i+1 === blobFields.length) { _%>
    } = <%= entityInstance %>Entity;
    <%_ } else { _%>
    ,
    <%_ } _%>
  <%_ } _%>

  const handleClose = () => {
    props.history.push('/<%= entityFileName %>'<%_ if (pagination === 'pagination') { _%> + props.location.search<%_ } _%>);
  }

  useEffect(() => {
    <%_ if (pagination === 'infinite-scroll') { _%>
    if (!isNew) {
      props.getEntity(props.match.params.id);
    }
    <%_ } else { _%>
    if (isNew) {
      props.reset();
    } else {
      props.getEntity(props.match.params.id);
    }
    <%_ } _%>

    <%_ otherEntityActions.forEach(val => { _%>
    props.<%= val.action %>();
    <%_ }) _%>
  }, []);

  <%_ if (fieldsContainBlob) { _%>
  const onBlobChange = (isAnImage, name) => event => {
    setFileData(event, (contentType, data) => props.setBlob(name, data, contentType), isAnImage);
  };

  const clearBlob = name => () => {
    props.setBlob(name, undefined, undefined);
  };
  <%_ } _%>

  useEffect(() => {
    if (props.updateSuccess) {
      handleClose();
    }
  }, [props.updateSuccess]);

  const saveEntity = (event, errors, values) => {
    <%_ for (idx in fields) {
        const fieldType = fields[idx].fieldType;
        const fieldName = fields[idx].fieldName;
    _%>
    <%_ if (fieldType === 'Instant' || fieldType === 'ZonedDateTime')  { _%>
    values.<%= fieldName %> = convertDateTimeToServer(values.<%= fieldName %>);
    <%_ } _%>
    <%_ } _%>

    if (errors.length === 0) {
      const entity = {
        ...<%= entityInstance %>Entity,
        ...values
        <%_ manyToManyOwners.forEach(rel => { _%>
        , <%= rel.relationshipFieldNamePlural %>: mapIdList(values.<%= rel.relationshipFieldNamePlural %>)
        <%_ }) _%>
      }
      <%_ if (uniqueRelationFields.has('users') && authenticationType === 'oauth2' && applicationType === 'gateway' && dto !== 'mapstruct') { _%>
        <%_ relationships.filter(rel => rel.relationshipType === 'one-to-one' && rel.ownerSide === true && rel.otherEntityName === 'user').forEach(rel => { _%>
      entity.<%= rel.relationshipFieldName %> = users.find(user => user.id.toString() === values.<%= rel.relationshipFieldName %>.id.toString());
        <%_ }) _%>
      <%_ } _%>

      if (isNew) {
        props.createEntity(entity);
      } else {
        props.updateEntity(entity);
      }
    }
  }

  return (
    <div>
    <Row className="justify-content-center">
      <Col md="8">
        <h2 id="<%= i18nKeyPrefix %>.home.createOrEditLabel" data-cy="<%= entityClass %>CreateUpdateHeading">
          <Translate contentKey="<%= i18nKeyPrefix %>.home.createOrEditLabel">Create or edit a <%= entityClass %></Translate>
        </h2>
      </Col>
    </Row>
    <Row className="justify-content-center">
      <Col md="8">
        { loading ? <p>Loading...</p> :
        <AvForm model={isNew ? {} : <%= entityInstance %>Entity} onSubmit={saveEntity} >
          { !isNew ?
            <AvGroup>
              <Label for="<%= entityFileName %>-id"><Translate contentKey="global.field.id">ID</Translate></Label>
              <AvInput id="<%= entityFileName %>-id" type="text" className="form-control" name="id" required readOnly/>
            </AvGroup>
            : null
          }
          <%_ for (idx in fields) {
              const fieldType = fields[idx].fieldType;
              const fieldName = fields[idx].fieldName;
              const fieldNameHumanized = fields[idx].fieldNameHumanized;
          _%>
          <AvGroup <% if (fieldType === 'Boolean') { %> check <% } %>>
          <%_ if (fieldType === 'Boolean') { _%>
            <Label id="<%= fieldName %>Label">
              <AvInput id="<%= entityFileName %>-<%= fieldName %>" data-cy="<%= fieldName %>" type="checkbox" className="form-check-input" name="<%= fieldName %>" />
              <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
                <%= fieldNameHumanized %>
              </Translate>
            </Label>
          <%_ } else if (['Instant', 'ZonedDateTime'].includes(fieldType)) { _%>
            <Label id="<%= fieldName %>Label" for="<%= entityFileName %>-<%= fieldName %>">
              <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
                <%= fieldNameHumanized %>
              </Translate>
            </Label>
            <AvInput
              id="<%= entityFileName %>-<%= fieldName %>"
              data-cy="<%= fieldName %>"
              type="datetime-local"
              className="form-control"
              name="<%= fieldName %>"
              placeholder={"YYYY-MM-DD HH:mm"}
              value={isNew ? displayDefaultDateTime() : convertDateTimeFromServer(props.<%= entityInstance %>Entity.<%= fieldName %>)}
              <%- include('react_validators'); %>
            />
          <%_ } else if (fieldType === 'LocalDate') { _%>
            <Label id="<%= fieldName %>Label" for="<%= entityFileName %>-<%= fieldName %>">
              <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
                <%= fieldNameHumanized %>
              </Translate>
            </Label>
            <AvField
              id="<%= entityFileName %>-<%= fieldName %>"
              data-cy="<%= fieldName %>"
              type="date"
              className="form-control"
              name="<%= fieldName %>"
              <%- include('react_validators'); %>
            />
          <%_
            } else if (fields[idx].fieldIsEnum) {
              const enumValues = fields[idx].enumValues;
          _%>
            <Label id="<%= fieldName %>Label" for="<%= entityFileName %>-<%= fieldName %>">
              <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
                <%= fieldNameHumanized %>
              </Translate>
            </Label>
            <AvInput
              id="<%= entityFileName %>-<%= fieldName %>"
              data-cy="<%= fieldName %>"
              type="select"
              className="form-control"
              name="<%= fieldName %>"
              value={(!isNew && <%= entityInstance %>Entity.<%= fieldName %>) || '<%= enumValues[0].name %>'}
            >
            <%_
              const enumPrefix = frontendAppName + '.'+ fieldType;
              enumValues.forEach(enumValue => {
            _%>
              <option value="<%= enumValue.name %>">
              <%_ if (enableTranslation) { _%>
                {translate("<%= enumPrefix %>.<%= enumValue.name %>")}
              <%_ } else { _%>
                <%= enumValue.value %>
              <%_ } _%>
              </option>
            <%_ }); _%>
            </AvInput>
          <%_ } else if (['Integer', 'Long', 'Float', 'Double'].includes(fieldType)) { _%>
            <Label id="<%= fieldName %>Label" for="<%= entityFileName %>-<%= fieldName %>">
              <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
                <%= fieldNameHumanized %>
              </Translate>
            </Label>
            <AvField id="<%= entityFileName %>-<%= fieldName %>" data-cy="<%= fieldName %>" type="string" className="form-control" name="<%= fieldName %>" <%- include('react_validators'); %> />
          <%_
          } else if (['byte[]', 'ByteBuffer'].includes(fieldType)) {

            const fieldBlobType = fields[idx].fieldTypeBlobContent;
            if (fieldBlobType !== 'text') {
              const isAnImage = fieldBlobType === 'image';
              const capitalizedFirstLetter =  _.upperFirst(fieldName);

          _%>

          <AvGroup>
            <Label id="<%= fieldName %>Label" for="<%= fieldName %>">
              <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
                <%= fieldNameHumanized %>
              </Translate>
            </Label>
            <br />
            {<%= fieldName %> ? (
              <div>
                {<%= fieldName %>ContentType ? (
                  <a onClick={openFile(<%= fieldName %>ContentType, <%= fieldName %>)}>
                  <%_ if (isAnImage) { _%>
                    <img src={`data:${<%= fieldName %>ContentType};base64,${<%= fieldName %>}`} style={{ maxHeight: '100px' }} />
                  <%_ } else { _%>
                    <Translate contentKey="entity.action.open">Open</Translate>
                  <%_ } _%>
                  </a>
                ) : null}
                <br />
                <Row>
                  <Col md="11">
                    <span>{<%= fieldName %>ContentType}, {byteSize(<%= fieldName %>)}</span>
                  </Col>
                  <Col md="1">
                    <Button color="danger" onClick={clearBlob('<%= fieldName %>')}><FontAwesomeIcon icon="times-circle" /></Button>
                  </Col>
                </Row>
              </div>
            ) : null}
            <input id="file_<%= fieldName %>" data-cy="<%= fieldName %>" type="file" onChange={onBlobChange(<%= isAnImage %>, '<%= fieldName %>')} <% if (isAnImage) { %>accept="image/*"<% } %> />
            <AvInput type="hidden" name="<%= fieldName %>" value={<%= fieldName %>} <%- include('react_validators'); %>/>
          </AvGroup>

          <%_ } else { _%>
            <Label id="<%= fieldName %>Label" for="<%= entityFileName %>-<%= fieldName %>">
              <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
                <%= fieldNameHumanized %>
              </Translate>
            </Label>
            <AvInput id="<%= entityFileName %>-<%= fieldName %>" data-cy="<%= fieldName %>" type="textarea" name="<%= fieldName %>" <%- include('react_validators'); %>/>
            <%_ } _%>
          <%_ } else { _%>
          <Label id="<%= fieldName %>Label" for="<%= entityFileName %>-<%= fieldName %>">
            <Translate contentKey="<%= i18nKeyPrefix %>.<%= fieldName %>">
              <%= fieldNameHumanized %>
            </Translate>
          </Label>
          <AvField id="<%= entityFileName %>-<%= fieldName %>" data-cy="<%= fieldName %>" type="text" name="<%= fieldName %>" <%- include('react_validators'); %>/>
        <%_ } _%>
          <%_ if (fields[idx].javadoc) { _%>
          <UncontrolledTooltip target="<%= fieldName %>Label">
            <%_ if (enableTranslation) { _%>
            <Translate contentKey="<%= i18nKeyPrefix %>.help.<%= fieldName %>"/>
            <%_ } else { _%>
            <%= fields[idx].javadoc %>
            <%_ } _%>
          </UncontrolledTooltip>
          <%_ } _%>
          </AvGroup>
          <%_ } _%>
          <%_ relationships.forEach(rel => {
              const relationshipType = rel.relationshipType;
              const ownerSide = rel.ownerSide;
              const otherEntityName = rel.otherEntityName;
              const otherEntityNamePlural = rel.otherEntityNamePlural;
              const otherEntityNameCapitalized = rel.otherEntityNameCapitalized;
              const relationshipName = rel.relationshipName;
              const relationshipNameHumanized = rel.relationshipNameHumanized;
              const relationshipFieldName = rel.relationshipFieldName;
              const relationshipFieldNamePlural = rel.relationshipFieldNamePlural;
              const otherEntityField = rel.otherEntityField;
              const otherEntityFieldCapitalized = rel.otherEntityFieldCapitalized;
              const relationshipRequired = rel.relationshipRequired;
              const translationKey = `${i18nKeyPrefix}.${relationshipName}`; _%>
              <%_ if (relationshipType === 'many-to-one' || (relationshipType === 'one-to-one' && ownerSide === true && otherEntityName === 'user')) { _%>
          <AvGroup>
            <Label for="<%= entityFileName %>-<%= relationshipName %>">
              <Translate contentKey="<%= translationKey %>"><%= relationshipNameHumanized %></Translate>
            </Label>
            <%_ if (dto === 'no') { _%>
                <%_ if (!relationshipRequired) { _%>
            <AvInput
              id="<%= entityFileName %>-<%= relationshipName %>"
              data-cy="<%= relationshipFieldName %>"
              type="select"
              className="form-control"
              name="<%= relationshipFieldName %>.id"
            >
              <option value="" key="0" />
              {
                <%= otherEntityNamePlural %> ? <%= otherEntityNamePlural %>.map(otherEntity =>
                  <option
                    value={otherEntity.id}
                    key={otherEntity.id}>
                    {otherEntity.<%= otherEntityField %>}
                  </option>
                ) : null
              }
            </AvInput>
              <%_ } else { _%>
            <AvInput
              id="<%= entityFileName %>-<%= relationshipName %>"
              data-cy="<%= relationshipFieldName %>"
              type="select"
              className="form-control"
              name="<%= relationshipFieldName %>.id"
              value={isNew ? <%= otherEntityNamePlural %>[0] && <%= otherEntityNamePlural %>[0].id : <%= entityInstance %>Entity.<%= relationshipName %>?.id}
              required
            >
              {
                <%= otherEntityNamePlural %> ? <%= otherEntityNamePlural %>.map(otherEntity =>
                  <option
                    value={otherEntity.id}
                    key={otherEntity.id}>
                    {otherEntity.<%= otherEntityField %>}
                  </option>
                ) : null
              }
            </AvInput>
            <AvFeedback><Translate contentKey="entity.validation.required">This field is required.</Translate></AvFeedback>
            <%_ } _%>
            <%_ } else { _%>
              <%_ if (!relationshipRequired) { _%>
                <AvInput
                  id="<%= entityFileName %>-<%= relationshipName %>"
                  data-cy="<%= relationshipFieldName %>"
                  type="select"
                  className="form-control"
                  name="<%= relationshipFieldName %>Id"
                >
                  <option value="" key="0" />
                  {
                    <%= otherEntityNamePlural %> ? <%= otherEntityNamePlural %>.map(otherEntity =>
                      <option
                        value={otherEntity.id}
                        key={otherEntity.id}>
                        {otherEntity.<%= otherEntityField %>}
                      </option>
                    ) : null
                  }
                </AvInput>
              <%_ } else { _%>
                <AvInput
                  id="<%= entityFileName %>-<%= relationshipName %>"
                  data-cy="<%= relationshipFieldName %>"
                  type="select"
                  className="form-control"
                  name="<%= relationshipFieldName %>Id"
                  required
                >
                  {
                    <%= otherEntityNamePlural %> ? <%= otherEntityNamePlural %>.map(otherEntity =>
                      <option
                        value={otherEntity.id}
                        key={otherEntity.id}>
                        {otherEntity.<%= otherEntityField %>}
                      </option>
                    ) : null
                  }
                </AvInput>
                <AvFeedback><Translate contentKey="entity.validation.required">This field is required.</Translate></AvFeedback>
              <%_ } _%>
            <%_ } _%>
          </AvGroup>
              <%_ } else if (relationshipType === 'one-to-one' && ownerSide === true) { _%>
          <AvGroup>
            <Label for="<%= entityFileName %>-<%= relationshipName %>">
              <Translate contentKey="<%= translationKey %>"><%= relationshipNameHumanized %></Translate>
            </Label>
              <%_ if (dto === 'no') { _%>
                <AvInput
                  id="<%= entityFileName %>-<%= relationshipName %>"
                  data-cy="<%= relationshipFieldName %>"
                  type="select"
                  className="form-control"
                  name="<%= relationshipFieldName %>.id"
                >
                  <option value="" key="0" />
                  {
                    <%= otherEntityNamePlural %> ? <%= otherEntityNamePlural %>.map(otherEntity =>
                      <option
                        value={otherEntity.id}
                        key={otherEntity.id}>
                        {otherEntity.<%= otherEntityField %>}
                      </option>
                    ) : null
                  }
                </AvInput>
              <%_ } else { _%>
                <AvInput
                  id="<%= entityFileName %>-<%= relationshipName %>"
                  data-cy="<%= relationshipFieldName %>"
                  type="select"
                  className="form-control"
                  name="<%= relationshipFieldName %>Id"
                >
                  <option value="" key="0" />
                  {
                    <%= otherEntityNamePlural %> ? <%= otherEntityNamePlural %>.map(otherEntity =>
                      <option
                        value={otherEntity.id}
                        key={otherEntity.id}>
                        {otherEntity.<%= otherEntityField %>}
                      </option>
                    ) : null
                  }
                </AvInput>
              <%_ } _%>
          </AvGroup>
              <%_ } else if (relationshipType === 'many-to-many' && rel.ownerSide === true) { _%>
          <AvGroup>
            <Label for="<%= entityFileName %>-<%= relationshipName %>"><Translate contentKey="<%= translationKey %>"><%= relationshipNameHumanized %></Translate></Label>
            <AvInput
              id="<%= entityFileName %>-<%= relationshipName %>"
              data-cy="<%= relationshipFieldName %>"
              type="select"
              multiple
              className="form-control"
              name="<%= relationshipFieldNamePlural %>"
              value={<%= entityInstance %>Entity.<%= relationshipFieldNamePlural %> && <%= entityInstance %>Entity.<%= relationshipFieldNamePlural %>.map(e => e.id)}
            >
              <option value="" key="0" />
              {
                (<%= otherEntityNamePlural %>) ? <%= otherEntityNamePlural %>.map(otherEntity =>
                <option
                    value={otherEntity.id}
                    key={otherEntity.id}>
                    {otherEntity.<%= otherEntityField %>}
                </option>
                ) : null
              }
            </AvInput>
          </AvGroup>
          <%_ } _%>
        <%_ }) _%>
          <Button tag={Link} id="cancel-save" to="/<%= entityFileName %>" replace color="info">
            <FontAwesomeIcon icon="arrow-left" />&nbsp;
            <span className="d-none d-md-inline" ><Translate contentKey="entity.action.back">Back</Translate></span>
          </Button>
          &nbsp;
          <Button color="primary" id="save-entity" data-cy="entityCreateSaveButton" type="submit" disabled={updating}>
            <FontAwesomeIcon icon="save" />&nbsp;
            <Translate contentKey="entity.action.save">Save</Translate>
          </Button>
        </AvForm>
        }
      </Col>
    </Row>
  </div>
  );
};

const mapStateToProps = (storeState: IRootState) => ({
  <%_ otherEntityActions.forEach(val => { _%>
    <%= val.instance %>: storeState.<%= val.reducer %>.<%= val.entity === 'User' ? val.instance : 'entities' %>,
  <%_ }) _%>
  <%= entityInstance %>Entity: storeState.<%= entityInstance %>.entity,
  loading: storeState.<%= entityInstance %>.loading,
  updating: storeState.<%= entityInstance %>.updating,
  updateSuccess: storeState.<%= entityInstance %>.updateSuccess,
});

const mapDispatchToProps = {
  <%_ otherEntityActions.forEach(val => { _%>
  <%= val.action %>,
  <%_ }) _%>
  getEntity,
  updateEntity,
  <%_ if (fieldsContainBlob) { _%>
  setBlob,
  <%_ } _%>
  createEntity,
  reset
};

type StateProps = ReturnType<typeof mapStateToProps>;
type DispatchProps = typeof mapDispatchToProps;

export default connect(mapStateToProps, mapDispatchToProps)(<%= entityReactName %>Update);
